package io;

import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

public class PWDemo1 {
    //缓冲字符流
    //java.io.BufferedWriter和BufferedReader 缓冲字符流是一堆高级的字符流，作用是块写文本数据加速
    //java.io.PrintWriter 具有自动刷新的缓冲字符输出流，内部总是连接BufferedWriter
    //更常用
    public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
        //向文件pw.txt写入文本数据
        PrintWriter pw=new PrintWriter("gfzj.txt","utf-8");
        pw.println("海岛，冰轮初转腾");
        pw.println("原来姹紫嫣红");
        pw.println("似这般，都赋予");
        System.out.println("写入完毕");
        pw.close();
    }
}
